package com.summer.service.Impl;
import com.summer.dao.UserDao;
import com.summer.pojo.User;
import com.summer.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    public User selectUserByUserName(String userName) {
        User user = userDao.selectUserByUserName(userName);
        return user;
    }

    @Override
    public User selectUserByID(int id) {
        User user = userDao.selectUserByID(id);
        return user;
    }

    @Override
    public int addUser(User user) {
        userDao.addUser(user);
        return 0;
    }

    @Override
    public int updateUser(User user) {
        userDao.updateUser(user);
        return 0;
    }

    @Override
    public int adminupdateUser(User user) {
        userDao.adminupdateUser(user);
        return 0;
    }

    @Override
    public List<User> selectAllUsers() {
        List<User> userList = userDao.selectAllUsers();
        return userList;
    }

    @Override
    public int deleteUserById(int id) {
        userDao.deleteUserById(id);
        return 0;
    }

}

